package com.kvn.blade.core.encoder;

import java.io.UnsupportedEncodingException;

/**
 * Created by wangzhiyuan on 2018/12/11
 */
public class ByteBufXmlEncoder implements Encoder {
    private static final XmlEncoder xmlEncoder = new XmlEncoder();
    @Override
    public Object encode(Object arg) {
        String xml = xmlEncoder.encode(arg).toString();
        System.out.println("ByteBufXmlEncoder = [" + xml + "]");
        try {
            return xml.getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
    }
}
